<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/page/share/taglib.jsp"  %>
<%@ include file="/WEB-INF/page/control/head.jsp"  %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>所有采集规则</title>
	  <script type="text/javascript">
		  function getbooklist(jsoup) {
			  var data = {};
              data.url = $("textarea[name='siteinfo.listUrl']").val();
              data.reg = $("textarea[name='siteinfo.contentUrlReg']").val();
              data.charset = $("input[name='siteinfo.charset']").val();

			  var url = "/control/collect/addcheckreg";
			  if(jsoup =="jsoup"){
                  url = "/control/collect/addcheckreg_jsoup";
			  }

              onejs.ajax(url,
                  data,function (data) {
                      var dataObj = eval( "(" + data + ")" );
                      onejs.debug(dataObj)
                      $("#tempcontent").val(dataObj.content);
                      $("#firstbook").val(dataObj.result);
                      $("#booklistfirstandcount").html(dataObj.result);
              });
          }

          function getbooktitle() {
              var data = {};
              data.url = $("#firstbook").val();
              data.reg = $("textarea[name='siteinfo.titleReg']").val();
              data.charset = $("input[name='siteinfo.charset']").val();

              onejs.ajax("/control/collect/addcheckreg",
                  data,function (data) {
                      var dataObj = eval( "(" + data + ")" );
                      onejs.debug(dataObj)
                      $("#booktitle").html(dataObj.result);
                  });
          }
          function getbookimgurlReg() {
              var data = {};
              data.url = $("#firstbook").val();
              data.reg = $("textarea[name='siteinfo.imgurlReg']").val();
              data.charset = $("input[name='siteinfo.charset']").val();

              onejs.ajax("/control/collect/addcheckreg",
                  data,function (data) {
                      var dataObj = eval( "(" + data + ")" );
                      onejs.debug(dataObj);
                      $("#bookimgurlReg").html(dataObj.result);
                  });
          }
          function getbookauthor() {
              var data = {};
              data.url = $("#firstbook").val();
              data.reg = $("textarea[name='siteinfo.authorReg']").val();
              data.charset = $("input[name='siteinfo.charset']").val();

              onejs.ajax("/control/collect/addcheckreg",
                  data,function (data) {
                      var dataObj = eval( "(" + data + ")" );
                      onejs.debug(dataObj);
                      $("#bookauthor").html(dataObj.result);
                  });
          }
          function getbookstate() {
              var data = {};
              data.url = $("#firstbook").val();
              data.reg = $("textarea[name='siteinfo.stateReg']").val();
              data.charset = $("input[name='siteinfo.charset']").val();

              onejs.ajax("/control/collect/addcheckreg",
                  data,function (data) {
                      var dataObj = eval( "(" + data + ")" );
                      onejs.debug(dataObj);
                      $("#bookstate").html(dataObj.result);
                  });
          }
          function getbookupdatetime() {
              var data = {};
              data.url = $("#firstbook").val();
              data.reg = $("textarea[name='siteinfo.updatetimeReg']").val();
              data.charset = $("input[name='siteinfo.charset']").val();

              onejs.ajax("/control/collect/addcheckreg",
                  data,function (data) {
                      var dataObj = eval( "(" + data + ")" );
                      onejs.debug(dataObj);
                      $("#bookupdatetime").html(dataObj.result);
                  });
          }function getbookintro() {
              var data = {};
              data.url = $("#firstbook").val();
              data.reg = $("textarea[name='siteinfo.introReg']").val();
              data.charset = $("input[name='siteinfo.charset']").val();

              onejs.ajax("/control/collect/addcheckreg",
                  data,function (data) {
                      var dataObj = eval( "(" + data + ")" );
                      onejs.debug(dataObj);
                      $("#bookintro").html(dataObj.result);
                  });
          }function getbookchapter() {
              var data = {};
              data.url = $("#firstbook").val();
              data.reg = $("textarea[name='siteinfo.chaptertitleAndUrlReg']").val();
              data.charset = $("input[name='siteinfo.charset']").val();

              onejs.ajax("/control/collect/addcheckreg",
                  data,function (data) {
                      var dataObj = eval( "(" + data + ")" );
                      onejs.debug(dataObj);
                      $("#chapterurl").val(dataObj.result);
                      $("#bookchapter").html(dataObj.result);
                  });
          }function getchaptercontent() {
              var data = {};
              data.key = "content";
              data.url = $("#chapterurl").val();
              data.reg = $("textarea[name='siteinfo.chapterContentReg']").val();
              data.charset = $("input[name='siteinfo.charset']").val();

              onejs.ajax("/control/collect/addcheckreg",
                  data,function (data) {
                      var dataObj = eval( "(" + data + ")" );
                      onejs.debug(dataObj);
                      $("#chaptercontent").html(dataObj.result);
                  });
          }

	  </script>
  </head>
  
  <body>
  <div style="width: 680px;float: left;">
  		<c:if test="${isedit}">
   		<form action="/control/collect/updatesitereg" method="post">
   		<input type="hidden" name="siteinfo.id" value="${siteinfo.id }"/>
   		</c:if>
   		<c:if test="${!isedit}">
   		<form action="/control/collect/insertsitereg" method="post">
   		</c:if>
   			站点名称：<input type="text" name="siteinfo.sitename" value="${siteinfo.sitename}"/><br/>
   			站点域名：<input type="text" name="siteinfo.domain" value="${siteinfo.domain}"/><br/>
   			网站字符集：<input type="radio" name="siteinfo.charset" value = "gbk" <c:if test="${siteinfo.charset == 'gbk'}">checked="checked"</c:if>/>gbk 
   			<input type="radio" name="siteinfo.charset" value = "utf-8" <c:if test="${siteinfo.charset == 'utf-8'}">checked="checked"</c:if>>utf-8<br>
   			类别页面网址(一行一个)：<br/>
   			<textarea  name="siteinfo.listUrl" style="width:600;height:260;heioverflow-x:visible;overflow-y:visible;">${siteinfo.listUrl}</textarea><br/>
   			类别小说列表页面-获取小说主页:采集规则([!contenturl])：<br/>
   			<textarea  name="siteinfo.contentUrlReg" style="width:600;height:260;overflow-x:visible;overflow-y:visible;">${siteinfo.contentUrlReg}</textarea><br/>
   			
   			
   			小说主页 标题采集规则([!title])：<br/>
   			<textarea  name="siteinfo.titleReg" style="width:600;height:260;overflow-x:visible;overflow-y:visible;">${siteinfo.titleReg}</textarea><br/>
			小说主页 封面采集规则([!imageurl])：<br/>
   			<textarea  name="siteinfo.imgurlReg" style="width:600;height:260;overflow-x:visible;overflow-y:visible;">${siteinfo.imgurlReg}</textarea><br/>
			小说主页 作者采集规则([!author])：<br/>
   			<textarea  name="siteinfo.authorReg" style="width:600;height:260;overflow-x:visible;overflow-y:visible;">${siteinfo.authorReg}</textarea><br/>
			小说主页 类型采集规则([!booktype])：<br/>
   			<textarea  name="siteinfo.booktypeReg" style="width:600;height:260;overflow-x:visible;overflow-y:visible;">${siteinfo.booktypeReg}</textarea><br/>
			小说主页 状态采集规则([!bookstate])：<br/>
   			<textarea  name="siteinfo.stateReg" style="width:600;height:260;overflow-x:visible;overflow-y:visible;">${siteinfo.stateReg}</textarea><br/>
			小说主页 更新时间采集规则([!updatetime])：<br/>
   			<textarea  name="siteinfo.updatetimeReg" style="width:600;height:260;overflow-x:visible;overflow-y:visible;">${siteinfo.updatetimeReg}</textarea><br/>
			小说主页 简介采集规则([!intro])：<br/>
   			<textarea  name="siteinfo.introReg" style="width:600;height:260;overflow-x:visible;overflow-y:visible;">${siteinfo.introReg}</textarea><br/>

			小说主页-获取章节标题与章节地址采集规则([!chapterurl],[!chaptertitle])：<br/>
   			<textarea  name="siteinfo.chaptertitleAndUrlReg"  style="width:600;height:260;overflow-x:visible;overflow-y:visible;">${siteinfo.chaptertitleAndUrlReg}</textarea><br/>
   			章节页面-内容采集规则([!chapterContent])：<br/>
   			<textarea  name="siteinfo.chapterContentReg"  style="width:600;height:260;overflow-x:visible;overflow-y:visible;">${siteinfo.chapterContentReg}</textarea><br/>
			章节页面-要替换的内容采集规则：(指的是内容页,一行一个)<br/>
   			<textarea  name="siteinfo.oldcontent"  style="width:600;height:260;overflow-x:visible;overflow-y:visible;">${siteinfo.oldcontent}</textarea><br/>
			章节页面-替换之后的内容：<br/>
   			<textarea  name="siteinfo.newcontent" style="width:600;height:260;overflow-x:visible;overflow-y:visible;">${siteinfo.newcontent}</textarea><br/>
   			
   			<input type="submit" value="提交"/>
   		</form>

  </div>
  <div style="width: 700px;float: left;padding-top: 120px;">
	  <textarea  id="tempcontent" style="width:600;height:260;overflow-x:visible;overflow-y:visible;"></textarea><br/>

	  <input type="button" value="类别小说列表页面-获取小说主页:采集规则" onclick="getbooklist()">
	  <input type="button" value="jsoup" onclick="getbooklist('jsoup')">
	  <div id="booklistfirstandcount" ></div><br>
	  小说主页：<input type="text" id="firstbook" style="width: 150px;"><br>
	  <input type="button" value="小说主页-标题:采集规则" onclick="getbooktitle()" style="margin-top: 260px;">
	  <div id="booktitle" ></div>
	  <input type="button" value="小说主页-封面:采集规则" onclick="getbookimgurlReg()" style="margin-top: 260px;">
	  <div id="bookimgurlReg" ></div>
	  <input type="button" value="小说主页-作者:采集规则" onclick="getbookauthor()" style="margin-top: 260px;">
	  <div id="bookauthor" ></div>
	  <input type="button" value="小说主页-状态:采集规则" onclick="getbookstate()" style="margin-top: 260px;">
	  <div id="bookstate" ></div>
	  <input type="button" value="小说主页-更新时间:采集规则" onclick="getbookupdatetime()" style="margin-top: 260px;">
	  <div id="bookupdatetime" ></div>
	  <input type="button" value="小说主页-简介时间:采集规则" onclick="getbookintro()" style="margin-top: 260px;">
	  <div id="bookintro" ></div>

	  <input type="button" value="小说主页-获取章节标题与章节地址:采集规则" onclick="getbookchapter()" style="margin-top: 260px;">
	  <div id="bookchapter" ></div>
	  章节页：<input type="text" id="chapterurl" style="width: 150px;"><br>

	  <input type="button" value="章节页-章节页面-内容" onclick="getchaptercontent()" style="margin-top: 260px;">
	  <div id="chaptercontent" ></div>

	  <div id="output"></div>
  </div>

  </body>
</html>
